from threading import Thread

from db import main as db_main
import celery_app


def run_beat() -> None:
    celery_app.app.start(['-A', 'celery_app', 'beat', '--loglevel=INFO'])


def run_worker() -> None:
    celery_app.app.start(['-A', 'celery_app', 'worker', '--loglevel=INFO'])


def main() -> None:
    """ Точка входа """

    thread1 = Thread(target=run_beat)
    thread2 = Thread(target=run_worker)

    thread1.start()
    thread2.start()

    thread1.join()
    thread2.join()


if __name__ == '__main__':
    main()
